import  {createRouter,createWebHistory} from "vue-router";
//createRouter 方法用于创建路由实例,可以管理多个路由
export default createRouter({
    //路由的模式设置
    history:createWebHistory(),
    //滚动行为,控制滚动条的位置
    scrollBehavior() {
        return {
            left: 0,
            top: 0,
        }
    },
    //管理路由
    routes: [
        {
            meta: {title: "首页"},
            path:"/",
            //重定向到首页
            redirect: '/home',
        },{
            meta: {title: "首页"},
            path:"/home",
            component: () => import("@/views/home/index.vue"),
        },{
            meta: {title: "登录"},
            path:"/wxlogin",
            component: () => import("@/views/wxlogin/index.vue"),
        },{
            // meta: {title: "医院详情页"},
            path:"/hospital",
            component: () => import("@/views/hospital/index.vue"),
            children:[
                {
                    meta: {title: "预约挂号"},
                    path:"register",
                    component: () => import("@/views/hospital/register/index.vue"),
                },{
                    meta: {title: "医院详情"},
                    path:"detail",
                    component: () => import("@/views/hospital/detail/index.vue"),
                },{
                    meta: {title: "预约通知"},
                    path:"notice",
                    component: () => import("@/views/hospital/notice/index.vue"),
                },{
                    meta: {title: "停诊信息"},
                    path:"close",
                    component: () => import("@/views/hospital/close/index.vue"),
                },{
                    meta: {title: "查询取消"},
                    path:"search",
                    component: () => import("@/views/hospital/search/index.vue"),
                },{
                    meta: {title: "预约第一步"},
                    path:"register_setp1",
                    component: () => import("@/views/hospital/register/register_setp1.vue"),
                },{
                    meta: {title: "确认第二步"},
                    path:"register_setp2",
                    component: () => import("@/views/hospital/register/register_setp2.vue"),
                },
            ],
        },{
            // meta: {title: "用户中心"},
            path:"/user",
            component: () => import("@/views/user/index.vue"),
            children:[
                {
                    meta: {title: "实名认证"},
                    path:"certificate",
                    component: () => import("@/views/user/certificate.vue"),
                },{
                    meta: {title: "挂号订单"},
                    path:"order",
                    component: () => import("@/views/user/order/index.vue"),
                },{
                    meta: {title: "就诊人管理"},
                    path:"patient",
                    component: () => import("@/views/user/patient.vue"),
                },{
                    meta: {title: "账号信息"},
                    path:"profile",
                    component: () => import("@/views/user/profile.vue"),
                },{
                    meta: {title: "意见反馈"},
                    path:"feedback",
                    component: () => import("@/views/user/feedback.vue"),
                },
            ],
        },
    ],

});














